package com.it.controller;

import com.it.domain.ResponseResult;
import com.it.service.LeaveWordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/leaveWord")
@Validated
public class LeaveWordController {

    @Autowired
    private LeaveWordService leaveWordService;

    /**
     * 获取留言板列表
     *
     * @param id
     * @return
     */
    @GetMapping("/list")
    public ResponseResult list(@RequestParam(value = "id", required = false) String id) {
        return leaveWordService.getLeaveWordList(id);
    }

    /**
     * 用户留言
     *
     * @param content
     * @return
     */
    @PostMapping("/auth/userLeaveWord")
    public ResponseResult userLeaveWord(@RequestBody String content) {
        return leaveWordService.userLeaveWord(content);
    }
}
